package me.m1key.springtx.entities;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "DOGS")
public class Dog {

	private Long id;
	private String name;
	private static final long serialVersionUID = 1L;
	private List<String> nicknames = new ArrayList<String>();

	public Dog() {
		super();
	}

	@Id
	@GeneratedValue
	@Column(name = "DOG_ID")
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "DOG_NAME")
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@ElementCollection(fetch = FetchType.EAGER)
	public List<String> getNicknames() {
		return nicknames;
	}

	public void setNicknames(List<String> nicknames) {
		this.nicknames = nicknames;
	}

	@Override
	public String toString() {
		return "[" + id + ", " + name + "]";
	}

}
